import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/home/index.vue'
import Layout from '../layout/index.vue'
import userPermissions from '../views/userPermissions/index.vue'

export const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: '/home',
    meta: {
      title: 'layout',
      icon: 'Avatar',
      isShow: false,
    },
    children: [
      {
        path: '/home',
        name: 'Home',
        component: Home,
        meta: {
          title: '首页',
          icon: 'House',
          isShow: true,
        },
      },
    ]
  },
  {
    path: '/permissions',
    name: 'Permissions',
    component: Layout,
    meta: {
      title: '权限管理',
      icon: 'Setting',
      isShow: true,
    },
    children: [
      {
        title: '用户权限',
        path: '/permissions/user',
        name: 'UserPermissions',
        component: userPermissions,
        meta: {
          title: '用户权限',
          icon: 'User',
          isShow: true,
        },
      }
    ]
  }
]

export const router = createRouter({
  history: createWebHistory(),
  routes
})